//
//  YYInspectVC.m
//  drivingSchool
//
//  Created by 子yu 刘 on 2018/8/18.
//  Copyright © 2018年 子yu 刘. All rights reserved.
//

#import "YYInspectVC.h"
#import "YYPersonageSubscribeVC.h"
#import "YYTeamSubscribeVC.h"

@interface YYInspectVC ()
@property (nonatomic,copy)NSString * price;

@end

@implementation YYInspectVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.bgView.layer.shadowOffset = CGSizeMake(1, 1);
    self.bgView.layer.shadowOpacity = 0.8;
    self.bgView.layer.shadowColor = [UIColor colorWithWhite:0.7 alpha:1].CGColor;
    [self getData];
}

- (void)getData{
    
    [RequestOperationManager personalRequirement_success:^(id result) {
        if (DEF_REQ_SUCCESS) {
            self.lbContent.text = result[@"data"][@"list"];
            self.price = result[@"data"][@"money"];
            self.lbPrice.text = [NSString stringWithFormat:@"备注：个人检车预约费为%@元，其余到检车时支付",result[@"data"][@"money"]];
        }
    } failture:^(NSError *error) {
        
    }];
}

- (IBAction)person:(id)sender {
    [AlertUtil showMessage:nil toView:self.view];
    [RequestOperationManager checkPeople_success:^(id result) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
         YYPersonageSubscribeVC * person = (YYPersonageSubscribeVC *)[CFUtility getVC:@"YYPersonageSubscribeVC" Storyboard:MINE];
        person.price = self.price;
        if (DEF_REQ_SUCCESS) {
            [self.navigationController pushViewController:person animated:YES];
        }else{
            [ASAlertViewController getAlertControllerWithTitle:nil message:@"您已预约个人检车，是否再次预约" sureTitle:@"确定" cancelTitle:@"取消" viewController:self sureAction:^(UIAlertAction *action) {
                [self.navigationController pushViewController:person animated:YES];
            } cancelAction:^(UIAlertAction *action) {
                
            }];
        }
    } failture:^(NSError *error) {
        
    }];
   
}

- (IBAction)team:(id)sender {
    [RequestOperationManager checkTeam_success:^(id result) {
           YYTeamSubscribeVC * team = (YYTeamSubscribeVC *)[CFUtility getVC:@"YYTeamSubscribeVC" Storyboard:MINE];
        if (DEF_REQ_SUCCESS) {
            [self.navigationController pushViewController:team animated:YES];
        }else{
            [ASAlertViewController getAlertControllerWithTitle:nil message:@"您已预约团队检车，是否再次预约" sureTitle:@"确定" cancelTitle:@"取消" viewController:self sureAction:^(UIAlertAction *action) {
                [self.navigationController pushViewController:team animated:YES];
            } cancelAction:^(UIAlertAction *action) {
                
            }];
        }
    } failture:^(NSError *error) {
        
    }];
   
}

@end
